package com.connector.base.config;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

public interface InstantConfig
{
    public static final Config cfg = load();

    static Config load() {
        final Config config = ConfigFactory.load("application.conf");
        return config;
    }

    public interface server
    {
        public static final Config cfg = InstantConfig.cfg.getObject("server").toConfig();
        public static final String host = server.cfg.getString("host");
        public static final boolean compress = server.cfg.getBoolean("compress");
        public static final boolean encryption = server.cfg.getBoolean("encryption");
        public static final int sessionExpiredTime = server.cfg.getInt("sessionExpiredTime");

        public interface connector
        {
            public static final Config cfg = server.cfg.getObject("connector").toConfig();
            public static final int port = connector.cfg.getInt("port");
            public static final int socketIoPort = connector.cfg.getInt("socketIoPort");
        }

        public interface websocket
        {
            public static final Config cfg = server.cfg.getObject("websocket").toConfig();
            public static final int port = websocket.cfg.getInt("port");
            public static final String wsPath = websocket.cfg.getString("wsPath");
        }

        public interface socketio
        {
            public static final Config cfg = server.cfg.getObject("socketio").toConfig();
            public static final int port = socketio.cfg.getInt("port");
            public static final String origin = socketio.cfg.getString("origin");
        }

        public interface cache
        {
            public static final Config cfg = server.cfg.getObject("cache").toConfig();
            public static final String type = cache.cfg.getString("type");
            public static final boolean enabled = cache.cfg.getBoolean("enabled");
        }

        public interface jmx
        {
            public static final Config cfg = server.cfg.getObject("jmx").toConfig();
            public static final String topic = jmx.cfg.getString("topic");
            public static final String type = jmx.cfg.getString("type");
            public static final boolean enabled = jmx.cfg.getBoolean("enabled");
        }

        public interface jeplantform
        {
            public static final Config cfg = server.cfg.getObject("jeplantform").toConfig();
            public static final String jeServerUrl = jeplantform.cfg.getString("jeServerUrl");
            public static final String transgerWithLogin = jeplantform.cfg.getString("transgerWithLogin");
            public static final String pushCertStatus = jeplantform.cfg.getString("pushCertStatus");
        }

        public interface jeaplantformapp
        {
            public static final Config cfg = server.cfg.getObject("jeaplantformapp").toConfig();
            public static final String jeAppServerUrl = jeaplantformapp.cfg.getString("jeAppServerUrl");
            public static final String transgerAppWithLogin = jeaplantformapp.cfg.getString("transgerAppWithLogin");
            public static final String pushAppCertStatus = jeaplantformapp.cfg.getString("pushAppCertStatus");
        }

        public interface business
        {
            public static final Config cfg = server.cfg.getObject("business").toConfig();
            public static final String instantServerUrl = business.cfg.getString("instantServerUrl");
            public static final String instantGetAllMsgUrl = business.cfg.getString("instantGetAllMsgUrl");
            public static final String instantUpdateMsgStatusUrl = business.cfg.getString("instantUpdateMsgStatusUrl");
            public static final String instantAddMessageUrl = business.cfg.getString("instantAddMessageUrl");
            public static final String instantGetGroupDetailUrl = business.cfg.getString("instantGetGroupDetailUrl");
        }

        public interface redis
        {
            public static final Config cfg = server.cfg.getObject("redis").toConfig();
            public static final String url = redis.cfg.getString("url");
            public static final int port = redis.cfg.getInt("port");
            public static final String password = redis.cfg.getString("password");
            public static final int timeout = redis.cfg.getInt("timeout");
            public static final int database = redis.cfg.getInt("database");
        }
    }
}
